package csel.model;

public class Key extends UseableItem
{
	private static final long serialVersionUID = 1L;

	public Key()
	{
		this.direction = Direction.SOUTH;
		typeId = "key";
	}
	
	public boolean use(Entity e)
	{
		if(Model.infoMode)System.out.println("[MODEL] Here i am " + e.getClass().getSimpleName());
		Direction facing = e.getDirection();
		Tile nextTile = getLocation().getNeighbor(facing);
		if(Model.infoMode)System.out.println("[MODEL] Here i am " + nextTile.getClass().getSimpleName());
		if(nextTile!=null)
		{
			Item nextItem = nextTile.getItem();
			if(nextItem!=null)
			{
				if(Model.infoMode)System.out.println("[MODEL] Here i am " + nextItem.getClass().getSimpleName());
				return(nextItem.touch(e));
			}
		}
		return(false);
	}

}
